<?php
$this->breadcrumbs=array(
	'商品管理'=>array('admin'),
	'列表',
);
include_once('menu.php');
Yii::app()->clientScript->registerScript('search', "
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('product-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'product-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'pid' => array(
			'name' => 'pid',
			'headerHtmlOptions' => array('width' => '5%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'pname' => array(
			'name' => 'pname',
			'headerHtmlOptions' => array('width' => '30%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'pcname' => array(
			'name' => 'pcname',
			'headerHtmlOptions' => array('width' => '10%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'price' => array(
			'name' => 'price',
			'headerHtmlOptions' => array('width' => '7%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'hongyun' => array(
			'name' => 'hongyun',
			'headerHtmlOptions' => array('width' => '10%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'coin' => array(
			'name' => 'coin',
			'headerHtmlOptions' => array('width' => '8%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'recommend' => array(
			'name' => 'recommend',
			'headerHtmlOptions' => array('width' => '6%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'status' => array(
			'name' => 'status',
			'headerHtmlOptions' => array('width' => '8%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'hot' => array(
			'name' => 'hot',
			'headerHtmlOptions' => array('width' => '6%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		array(
            'class' => 'CButtonColumn',
            'header' => '操作',
            'template' => '{edit}{recommend}{soldout}',
			'buttons' => array(
                'edit' => array(
                    'label' => '修改',
                    'imageUrl' => Yii::app()->baseUrl . '/images/edit.png',
                    'url' => 'Yii::app()->controller->createUrl("product/update",array("id"=>$data->pid))',
                ),
                'recommend' => array(
                    'label' => '推薦',
                    'imageUrl' => Yii::app()->baseUrl . '/images/heart.png',
                    'url' => 'Yii::app()->controller->createUrl("product/recommend",array("id"=>$data->pid))',
                ),
                'soldout' => array(
                    'label' => '上/下架',
                    'imageUrl' => Yii::app()->baseUrl . '/images/up.png',
                    'url' => 'Yii::app()->controller->createUrl("product/soldout",array("id"=>$data->pid))',
                ),
            ),    
        ),
	),
)); ?>
